//
// The resource management layer has been upgraded, thus deprecating this file.
//
#error *** resfile.h has been deprecated. ***

#ifndef RESFILE_H
#define RESFILE_H


//---------------------------------------------------------------------------
//  CResFile class definition.
//

// NOTE: If you change VERSION_MAJOR, *every* resource file *must* be
//       rebuilt (with a newly built resource compiler).
#define VERSION_MAJOR		3
#define VERSION_MINOR		0
#define VERSION_PATCH		0
#define VERSION_BUILD		0

typedef struct _CResFile
{
	uint8			cVersion[4];
	uint8			cAttributes[4];
	pCStream		cStream;
	pCHashTable		cHashTable;
	pCResFile		cNext;
} CResFile;


PLIBEXP pCResFile	newCResFile(const String & ResFileName);
PLIBEXP void		deleteCResFile(pCResFile This);
bool8			CResFileConstruct(pCResFile This, const String & ResFileName);
void			CResFileDestruct(pCResFile This);

PLIBEXP void *	CResFileGetResource(pCResFile This, char * ResName);
PLIBEXP bool8	CResFileReleaseResource(pCResFile This, void * ResData);

PLIBEXP void	CResFileHashDelete(pCHashTable, void *HashData, void *UserData);


//----------------------------------------------------------------------------
//  Everything in this section has been written specifically for 
//     Resource Compilers.
//
#ifdef RESCOMPILER
pCResFile	createCResFile(uint8 Endian);
void		CResFileDumpToFile(pCResFile This, const String & Filename);
pCHashTable CResFileBuildGroupIndex(pCResFile This, uint32 * GroupCount);
bool8		CResFileAddResourceByResName(pCResFile This, char * ResName, 
				uint32 ResGrp, void * ResData, uint32 Length);
bool8		CResFileAddResourceByResGrp(pCResFile This, char * ResName, 
				uint32 ResGrp, void * ResData, uint32 Length);
bool8		CResFileRemoveResourceByResName(pCResFile, char *, uint32);
void		CResFileDumpTableOfContents(pCResFile This);
#endif



//------------------------------------------------------------------------------
//  Resource file structures follow...
//     NOTE: The structures have been designed to align on _all_ boundries.
//
typedef struct _RFHeader
{
	uint8		cMagic[8];
	uint8		cVersion[4];
	uint8		cAttributes[4];
	uint32		cIndexOffset;
	uint32		cIndexEntries;
} RFHeader;
#define endianRFHeader "p16w4w4"

#define RFMagic		"ResFile"

// TBD: This is my proposed extension, which you can see doesn't contain
//      anything ... yet.   2004.06.25 - kral.
//
//typedef struct _RFExtendedHeader
//{
//} RFExtendedHeader;
//#define endianRFExtendedHeader ""


typedef struct _RFIndex
{
	char 		cReserved[4];
	uint32		cGroupID;
	uint32		cOffset;
	uint32		cEntries;
} RFIndex;
#define endianRFIndex	"p4w4w4w4"


#define resfileNAME_LENGTH		16

typedef struct _RFEntry
{
	char 		cName[ resfileNAME_LENGTH ];
	uint32		cOffset;
	uint32		cSize;
} RFEntry;
#define endianRFEntry	"p16w4w4"

typedef struct _RFCompressedEntry
{
	char 		cName[ resfileNAME_LENGTH ];
	uint32		cOffset;
	uint32		cSize;
	uint32		cCompressedSize;
} RFCompressedEntry;
#define endianRFCompressedEntry		"p16w4w4w4"


#endif
